\documentclass[a4paper,twoside]{ctexart}
\usepackage{geometry}
\geometry{margin=1cm,vmargin={0pt,1cm}}
\setlength{\topmargin}{-2cm}
\setlength{\paperheight}{23cm}
\setlength{\paperwidth}{18cm}
\setlength{\textheight}{19.6cm}
\setlength{\textwidth}{15cm}
\usepackage{makecell}
\usepackage{fancyhdr}
\usepackage{siunitx}
\usepackage{amssymb}
\usepackage{indentfirst}
\setlength{\parindent}{0.5em}

\pagenumbering{arabic}

% useful packages.
\usepackage{multirow}
\usepackage{caption}
\usepackage{mathrsfs}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{enumerate}
\usepackage{xcolor,graphicx,float,subfigure}
\usepackage{epstopdf}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage{layout}
\usepackage{listings}
\usepackage{diagbox}
\lstset{language=Matlab}
\lstset{breaklines}
\lstset{extendedchars=false}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage{xcolor}
\usepackage{cite}
\usepackage[numbers,sort&compress]{natbib}
\setcitestyle{open={},close={}}
%\usepackage{natbibspacing}
%\renewcommand{\refname}{}
\usepackage{anyfontsize}

% English theorem environment
\theoremstyle{definition}
\newtheorem{proposition}[section]{Proposition}
\newtheorem{corollary}[section]{Corollary}
\newtheorem{definition}{Definition}[section]
\newtheorem{remark}[section]{Remark}
\newtheorem{example}[definition]{Example}
\newtheorem{exercise}[definition]{Exercise}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{lemma}[definition]{Lemma}
\newenvironment{solution}{\begin{proof}[Solution]}{\end{proof}}
\renewcommand{\proofname}{\noindent Proof}
% some common command
\newcommand{\dif}{\mathrm{d}}
\newcommand{\avg}[1]{\left\langle #1 \right\rangle}
\newcommand{\pdfrac}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\op}{\odot}
\newcommand{\Eabs}{E_{\mathrm{abs}}}
\newcommand{\Erel}{E_{\mathrm{rel}}}
\newcommand{\Ediv}{\mathrm{div}}%\div是除号
\newcommand{\lrq}[1]{\left( #1 \right)}
\newcommand{\avint}[1]{\frac{1}{\left|#1\right|}\int_{#1}}

\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}} 

\makeatletter
\newcommand\sixteen{\@setfontsize\sixteen{17pt}{6}}
\renewcommand{\maketitle}{\bgroup\setlength{\parindent}{0pt}
\begin{flushleft}
\sixteen\bfseries \@title
\medskip
\end{flushleft}
\texttt{\@author}
\egroup}
\renewcommand{\maketag@@@}[1]{\hbox{\m@th\normalsize\normalfont#1}}
\makeatother
\setlength{\abovecaptionskip}{0.cm}
\setlength{\floatsep}{0.cm}
\setlength{\intextsep}{0.cm}

%\CTEXsetup[format={\Large\bfseries}]{section}

\title{微分方程数值解\ 第2次作业}
\author{李之琪 22235056}

\begin{document}
\maketitle

\section{收敛结果测试}
\subsection{FTCS方法}
对FTCS方法，取$h = \dfrac{2\pi}{n}, k = h/2$，终止时刻$T = 2\pi$，则计
算结果的误差如表\ref{table:FTCS}所示，这里的误差范数采用无穷范数。\\
\begin{table}[!htp]
    \centering\begin{tabular}{c|ccccccc}
        \hline
         $n$&16&ratio&32&ratio&64&ratio&128\\
        \hline
         err &5.30e$+$0&-2.98&4.19e$+$1&-8.51&1.52e$+$4&-19.15&8.87e$+$9\\
         \hline
      \end{tabular}
    \caption{FTCS收敛性测试，$h = 2\pi/n, k = h/2$，终止时刻$T = 2\pi$。}
    \label{table:FTCS}
  \end{table}\\
  显然，在$k = O(h)$的条件下，FTCS方法并不收敛。这与理论分析的结果一致。
  上述结果可以通过运行\texttt{FTCS\_err.m}文件得到。
  \subsection{Lax\_Friedrichs方法}
对Lax\_Friedrichs方法，取相同的参数，计算结果的误差与收敛阶如表\ref{table:Lax_Friedrichs}所示。\\
\begin{table}[!htp]
    \centering\begin{tabular}{c|ccccccc}
        \hline
         $n$&16&ratio&32&ratio&64&ratio&128\\
        \hline
         err &1.37e$+$1&0.37&1.06e$+$1&0.47&7.65e$-$1&0.50&5.42e$-$1\\
         \hline
      \end{tabular}
    \caption{Lax\_Friedrichs收敛性测试，$h = 2\pi/n, k = h/2$，终止时刻$T = 2\pi$。}
    \label{table:Lax_Friedrichs}
  \end{table}\\
 测试表明，在$k = O(h)$的条件下，Lax\_Friedrichs方法对初始函数$f$是收
 敛的。另一方面，测试结果在空间上甚至无法达到一阶精度，这是因为初始函
 数和精确解不是$C^1$的，这样的非流形点造成了精度的损失。上述结果可以通过运行\texttt{Lax\_Friedrichs\_err.m}文件得到。
  \subsection{Lax\_Wendroff方法}
对Lax\_Wendroff方法，仍取相同的参数，计算结果的误差与收敛阶如表\ref{table:Lax_Wendroff}所示。\\
\begin{table}[!htp]
    \centering\begin{tabular}{c|ccccccc}
        \hline
         $n$&16&ratio&32&ratio&64&ratio&128\\
        \hline
         err &3.59e$-$1&0.66&2.26e$-$1&0.65&1.44e$-$1&0.66&9.14e$-$2\\
         \hline
      \end{tabular}
    \caption{Lax\_Wendroff收敛性测试，$h = 2\pi/n, k = h/2$，终止时刻$T = 2\pi$。}
    \label{table:Lax_Wendroff}
  \end{table}\\
 测试表明，在$k = O(h)$的条件下，Lax\_Wendroff方法对初始函数$f$也是收
 敛的。精度丢失的原因与Lax\_Friedrichs方法相同。上述结果可以通过运行\texttt{Lax\_Wendroff\_err.m}文件得到。
 \section{可视化结果展示}
 图\ref{fig:0}是对图1.2.2的复现，图\ref{fig:1}和图\ref{fig:2}是对图1.2.3的复现。可以通过运行
 \texttt{main0.m}，\texttt{main1.m}和\texttt{main2.m}文件得到。
 \\
 \begin{figure}[!htp]   
	\centering
	\includegraphics[width=16cm]{Picture/F0.eps}
	\caption{FTCS方法，$\max_j\|v_j^n \|$.(a)$h = 0.01; k = 0.01$，(b)$h = 0.01; k = 0.1$。}
	\label{fig:0}
      \end{figure}
 \begin{figure}[!htp]   
	\centering
	\includegraphics[width=12cm]{Picture/F1.eps}
	\caption{Lax\_Friedrichs方法，$h_1 = 2\pi/10$，$h_2 = 2\pi/100$。}
	\label{fig:1}
      \end{figure}
       \begin{figure}[!htp]   
	\centering
	\includegraphics[width=12cm]{Picture/F2.eps}
	\caption{Lax\_Wendroff方法，$h_1 = 2\pi/10$，$h_2 = 2\pi/100$。}
	\label{fig:2}
\end{figure}
\end{document}

